package com.bilibili.xzz.controller;

import com.bilibili.xzz.utils.Result;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


@RestController
@RequestMapping("/api/message")
public class MessageController {

    @Resource
    private StringRedisTemplate stringRedisTemplate;

    @PostMapping("/server_info")
    public Result Message() {
        ValueOperations<String, String> operations = stringRedisTemplate.opsForValue();
        operations.increment("count");
        return Result.ok().data("count",operations.get("count"));
    }

}
